package cn.z2huo.demo.spring.webmvc.controller;

import cn.z2huo.demo.spring.webmvc.config.WebSessionMethodArgumentResolver;
import cn.z2huo.demo.spring.webmvc.model.Attribute;
import cn.z2huo.demo.spring.webmvc.model.Session;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;

import java.util.Map;

/**
 * <p>{@link HandlerMethodArgumentResolver} 测试
 *
 * @author z2huo
 */
@Slf4j
@RestController
public class MethodArgumentResolverTestController {

    @RequestMapping("/test/postTest")
    public void postTest(Session session, @RequestBody Map<String, Object> req) {
        log.info("TestController, /test/postTest, reqBody is {}", req);
    }

    /**
     *
     * @see WebSessionMethodArgumentResolver
     */
    @PostMapping("/test/methodArgResolverTest")
    public void methodArgsTest(Session session, Attribute attribute) {
        log.info("TestController, /test/methodArgResolverTest, method arg session is {}", session);
        log.info("TestController, /test/methodArgResolverTest, method arg attribute is {}", attribute);
    }

}
